package cn.wolfcode.wms.web.controller;

import cn.wolfcode.wms.domain.Brand;
import cn.wolfcode.wms.domain.Depot;
import cn.wolfcode.wms.domain.ProductStock;
import cn.wolfcode.wms.page.PageResult;
import cn.wolfcode.wms.qo.ProductStockQueryObject;
import cn.wolfcode.wms.service.BrandService;
import cn.wolfcode.wms.service.DepotService;
import cn.wolfcode.wms.service.ProductStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("productStock")
public class ProductStockController {
@Autowired
private ProductStockService productStockService;
@Autowired
private DepotService depotService;
@Autowired
private BrandService brandService;
    @RequestMapping("list")
    public String list(Map map, ProductStockQueryObject qo){
        List<Depot> depots = depotService.selectAll();
        List<Brand> brands = brandService.selectAll();
        map.put("brands",brands);
        map.put("depots",depots);
        map.put("qo",qo);
        PageResult result = productStockService.selectAll(qo);
        map.put("result",result);
        return "productStock/list";
    }
}
